<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix='sec' uri='http://www.springframework.org/security/tags'%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>话务中心</title>
	<script type="text/javascript" src="scripts/boot.js"></script>
    <style type="text/css">
	    html,body
	    {
	    	height:100%;
	    	margin:0;,padding:0;
	    }
	    .asLabel .mini-textbox-border,
	    .asLabel .mini-textbox-input,
	    .asLabel .mini-buttonedit-border,
	    .asLabel .mini-buttonedit-input,
	    .asLabel .mini-textboxlist-border
	    {
	        border:0;background:none;cursor:default;
	    }
    </style>
</head>
<body>
	<div id="toolbar1" class="mini-toolbar" style="padding:2px;" align="right">
		<div class="toplogo"><img src="scripts/miniui/themes/default/images/layout/logo-huawu.png" /></div>
        <a class="mini-button mini-button-iconTop" iconCls="icon-extension" plain="true" onclick="loginExtension" id="btn_lo_ex">登录分机</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-extension" plain="true" onclick="leave" id="btn_leave" visible="false">离席</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-outgoing" plain="true" onclick="outgoing" id="btn_outgoing" enabled="false">呼出</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-outgoing" plain="true" onclick="telHangUp" id="btn_hangup" enabled="false">挂断</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-idle" plain="true" onclick='showIdle("true")' id="btn_busy">示忙</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-idle" plain="true" onclick='showIdle("false")' id="btn_idle">示闲</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-turn" plain="true" id="btn_blind_turn" onclick="blindTurn" enabled="false">盲转</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-tip" plain="true" onclick="showMsg()">消息提醒(<span id="msgNum">${requestScope.num}</span>)</a>
        <a class="mini-button mini-button-iconTop" iconCls="icon-close" style="float: right;" onclick="logOut()" plain="true" >退出</a>
    </div>
<!--     登录分机 -->
	<input class="mini-hidden" id="queueNum" />
    <div id="win1" class="mini-window" allowDrag="false" showCloseButton="false" showModal="false" showHeader="true" title="登录分机" style="width: 280px;height: 170px;">
    	<input class="mini-hidden" id="workId" value="<sec:authentication property='principal.username'/>" />
	    <input labelField="true" label="分机号：" labelStyle="width: 90px;" class="mini-textbox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="extenNumId" required="true"/> 
<!-- 		<input labelField="true" label="选择队列：" labelStyle="width: 90px;" class="mini-combobox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="queueNumId" textField="text" multiSelect="true" valueField="text" data="[{id: 9000, text: 9000},{id: 8000, text: 8000}]"/>  -->
		<input labelField="true" label="选择队列：" labelStyle="width: 90px;" class="mini-combobox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="queueNumId" textField="queueNo" multiSelect="true" valueField="queueNo" url="alternately_find_queue.do"/> 
		<div style="text-align:center;padding-bottom: 10px;margin-top: 30px;">
			<a class="mini-button" onclick="loginExtensionOk" style="">确定</a>
			<a class="mini-button" onclick="onClose1" style="margin-left: 50px;">关闭</a>
		</div>
	</div>
<!-- 	呼出弹窗 -->
    <div id="win2" class="mini-window" allowDrag="false" showHeader="true" title="呼出" style="width: 280px;height: 150px;">
	    <input class="mini-hidden" id="callerNum" />
	    <input labelField="true" label="号码：" labelStyle="width: 90px;" class="mini-textbox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="outNumId" required="true"/> 
	    <input labelField="true" label="加拨：" labelStyle="width: 90px;" class="mini-combobox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="addNum"
	    	url="dictionary_cm_key_val_view.do?typeName=CALL_ADD_TYPE" textField="keyValue" valueField="keyValue" showNullItem="true" nullItemText="无"/> 
		<div style="text-align:center;padding-bottom: 10px;margin-top: 15px;">
			<a class="mini-button" onclick="outgoingOk" style="">确定</a>
			<a class="mini-button" onclick="onClose2" style="margin-left: 50px;">关闭</a>
		</div>
	</div>
<!-- 	盲转弹窗 -->
	<input class="mini-hidden" id="cur_tab_name" />
    <div id="win3" class="mini-window" allowDrag="false" showHeader="true" title="盲转" style="width: 280px;height: 140px;">
	    <input labelField="true" label="转接分机号：" labelStyle="width: 90px;" class="mini-textbox" style="width:200px;margin-top: 10px;margin-left: 15px;" id="blindTurnNum" /> 
		<div style="text-align:center;padding-bottom: 10px;margin-top: 30px;">
			<a class="mini-button" onclick="blindTurnOk" >确定</a>
			<a class="mini-button" onclick="onClose3" style="margin-left: 50px;">关闭</a>
		</div>
	</div>
	<input class="mini-hidden" id="user_id" value="<sec:authentication property='principal.id'/>" />
    <div class="mini-fit">
    <div class="mini-splitter" style="width:100%;height:100%;" borderStyle="border-top:none;">
    <div size="15%" showCollapseButton="true">
	    <table cellpadding="0" cellspacing="0" style="height:100%;width:100%;table-layout:fixed">
	        <tr>
	            <td style="width:30px;height:100%;">
	                <div class="leftNav">
	                    <div style="padding-top:20px;">
	                    	<sec:authorize url='/cm_sys_manger.do'>
	                        <a class="leftNav-cm selected" title="话务中心" href="${urlPath}/cm"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/om_sys_manger.do'>
	                        <a class="leftNav-om" title="订单中心" href="${urlPath}/om"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/wm_sys_manger.do'>
	                        <a class="leftNav-wm" title="仓储中心" href="${urlPath}/wm"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/fm_sys_manger.do'>
	                        <a class="leftNav-fm" title="财务中心" href="${urlPath}/fm"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/mm_sys_manger.do'>
	                        <a class="leftNav-mm" title="媒体中心" href="${urlPath}/mm"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/ss_sys_manger.do'>
	                        <a class="leftNav-ss" title="统计中心" href="${urlPath}/ss"></a>
	                        </sec:authorize>
	                        <sec:authorize url='/hm_sys_manger.do'>
	                        <a class="leftNav-hm" title="人资中心" href="${urlPath}/hm"></a>
	                        </sec:authorize>
	                    </div>
	                </div>
	            </td>
	            <td style="height:100%;">
<!-- 	                <div id="outlookbar1" class="mini-outlookbar" activeIndex="0" style="width:auto;height:100%;" autoCollapse="true">     -->
<!-- 	                    <div title="话务任务管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 				           <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_allocate_init', text:'话务分配', url:'call_allocate_init.do'});">话务分配</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				           <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_allocate_center_init', text:'中心话务分配', url:'call_allocate_center_init.do'});">中心话务分配</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				           <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_allocate_group_init', text:'组长话务分配', url:'call_allocate_group_init.do'});">组长话务分配</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				           <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_manage_init', text:'话务管理', url:'call_manage_init.do'});">话务管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_manage_center_init', text:'中心话务管理', url:'call_manage_center_init.do'});">中心话务管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_manage_group_init', text:'组长话务管理', url:'call_manage_group_init.do'});">组长话务管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_manage_my_init', text:'我的话务管理', url:'call_manage_my_init.do'});">我的话务管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 	        			</div> -->
<!-- 	                    <div title="订单查询" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 	                    	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'all_orders_inquiry_init', text:'所有订单查询', url:'all_orders_inquiry_init.do'});">所有订单查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'center_orders_inquiry_init', text:'中心订单查询', url:'center_orders_inquiry_init.do'});">中心订单查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'group_orders_inquiry_init', text:'本组订单查询', url:'group_orders_inquiry_init.do'});">本组订单查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'my_orders_inquiry_init', text:'我的订单查询', url:'my_orders_inquiry_init.do'});">我的订单查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 	                    </div> -->
<!-- 	        			<div title="电话管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_recording_init', text:'电话录音', url:'call_recording_init.do'});">电话录音</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'recording_center_init', text:'中心录音查询', url:'recording_center_init.do'});">中心录音查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'recording_group_init', text:'组长录音查询', url:'recording_group_init.do'});">组长录音查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'recording_my_init', text:'我的录音查询', url:'recording_my_init.do'});">我的录音查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'recording_open_init', text:'公开录音查询', url:'recording_open_init.do'});">公开录音查询</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_details_init', text:'来电明细信息', url:'call_details_init.do'});">来电明细信息</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_information_init', text:'呼出明细信息', url:'call_information_init.do'});">呼出明细信息</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_duplicate_removal_init', text:'去重来电信息', url:'call_duplicate_removal_init.do'});">去重来电信息</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_duplicate_removal_statistics_init', text:'去重来电统计', url:'call_duplicate_removal_statistics_init.do'});">去重来电统计</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_blacklist_init', text:'黑名单管理', url:'call_blacklist_init.do'});">黑名单管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 	        			</div> -->
<!-- 	        			<div title="计费管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'preferential_scheme_init', text:'优惠方案管理', url:'preferential_scheme_init.do'});">优惠方案管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_tariff_init', text:'资费表管理', url:'call_tariff_init.do'});">资费表管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'call_records_init', text:'话单记录管理', url:'call_records_init.do'});">话单记录管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 	        			</div> -->
<!-- 	        			<div title="短信管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'sms_init', text:'短信管理', url:'sms_init.do'});">短信管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'sms_center_init', text:'中心短信管理', url:'sms_center_init.do'});">中心短信管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'sms_group_init', text:'本组短信管理', url:'sms_group_init.do'});">本组短信管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 							<div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'sms_my_init', text:'我的短信管理', url:'sms_my_init.do'});">我的短信管理</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 				            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 								<div class="mini-menuitem"> -->
<!-- 									<div class="mini-menuitem-inner"> -->
<!-- 										<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 										<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'sms_common_settings_init', text:'常用短语设置', url:'sms_common_settings_init.do'});">常用短语设置</a></div> -->
<!-- 										<div class="mini-menuitem-allow"></div> -->
<!-- 									</div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 	        		</div> -->
<!-- 			        <div title="日报管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'init_call_group_sta_list', text:'本组电话统计', url:'init_call_group_sta_list.do'});">本组电话统计</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'init_task_group_sta_list', text:'本组任务统计', url:'init_task_group_sta_list.do'});">本组任务统计</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'init_call_center_sta_list', text:'中心电话统计', url:'init_call_center_sta_list.do'});">中心电话统计</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'init_task_center_sta_list', text:'中心任务统计', url:'init_task_center_sta_list.do'});">中心任务统计</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 	        		</div> -->
<!-- 			        <div title="统计管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'staff_task_init', text:'员工任务统计', url:'staff_task_init.do'});">员工任务统计</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'per_ana_staff_init', text:'员工业绩分析', url:'per_ana_staff_init.do'});">员工业绩分析</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'per_ana_group_init', text:'小组业绩分析', url:'per_ana_group_init.do'});">小组业绩分析</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			            <div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'per_ana_center_init', text:'中心业绩分析', url:'per_ana_center_init.do'});">中心业绩分析</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 	        		</div> -->
<!--         			<div title="客户管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'customer_manage_init', text:'客户管理', url:'customer_manage_init.do'});">客户管理</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'customer_remind_init', text:'客户提醒', url:'customer_remind_init.do'});">客户提醒</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'my_customer_remind_init', text:'我的客户提醒', url:'my_customer_remind_init.do'});">我的客户提醒</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!--         			</div> -->
<!--         			<div title="系统管理" iconCls="icon-addfolder" headerStyle="font-size: medium;"> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'task_save_init', text:'话务保存设置', url:'task_save_init.do'});">话务保存设置</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'health_init', text:'健康档案', url:'health_init.do'});">健康档案</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'dic_init', text:'数据字典管理', url:'dic_init.do'});">数据字典管理</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!-- 			        	<div class="mini-menu-float" style="height: auto;"> -->
<!-- 							<div class="mini-menuitem"> -->
<!-- 								<div class="mini-menuitem-inner"> -->
<!-- 									<div class="mini-menuitem-icon icon-node" style="display: block;"></div> -->
<!-- 									<div class="mini-menuitem-text"><a class="mini-menuitem-text" href="javascript:showTab({id: 'alternately_play_screen', text:'弹屏页面', url:'alternately_play_screen.do'});">模拟弹屏</a></div> -->
<!-- 									<div class="mini-menuitem-allow"></div> -->
<!-- 								</div> -->
<!-- 							</div> -->
<!-- 						</div> -->
<!--         			</div> -->
<!-- 	                </div> -->
					<div class="mini-outlookmenu" style="height:100%;width:100%;" expandOnLoad="false" borderStyle="border:0;border-left:1px solid #95bae7" idField="id" parentField="pid" textField="text" url="loadMenu.do" onitemclick="itemclick">
                   	</div>
	            </td>
	        </tr>
	    </table>
    </div>
    <div style="background:#ececec;">
        <!--Tabs-->
        <div id="mainTabs" class="mini-tabs bg-toolbar" contextMenu="#tabsMenu" activeIndex="0" style="width:100%;height:100%;" bodyStyle="border:0;background:white;">        
            <div name="first" title="首页" url="" style="width:100%;height:100%;">
				<div id="panel1" class="mini-panel" title="工作排名" iconCls="icon-add" style="width:400px;height:200px;margin-top: 5px; margin-left: 15px;" 
    				showToolbar="true" showCollapseButton="true" showFooter="true" allowResize="false" collapseOnTitleClick="true">
    				
    				你好：<span><sec:authentication property='principal.name'/></span>
    					【<span><sec:authentication property='principal.username'/></span>】&nbsp;&nbsp;&nbsp;
    				已登录分机：<input id="s_extension" style="width: 100px;" name="username" class="mini-textbox asLabel" readOnly="true" value=""/><br />
    				已加入队列：<input id="s_queue" style="width: 100px;" name="username" class="mini-textbox asLabel" readOnly="true" value=""/><br />
    				上次登录时间：<span id="last_time"></span>
    				<input class="mini-hidden" id="last_login_time" value="<sec:authentication property='principal.lastLoginTime'/>"/>
    			</div>
            </div>
        </div> 
        <ul id="tabsMenu" class="mini-contextmenu" onbeforeopen="onBeforeOpen">
	        <li onclick="refreshTab">刷新标签页</li>                
	        <li onclick="closeTab">关闭标签页</li>                
		    <li onclick="closeAll">关闭所有标签页</li>        
	        <li onclick="closeAllButFirst">关闭其他标签页</li>   
    	</ul>
    </div>
    </div>
    </div>
    
    <div title="south" region="south" showSplit="false" showHeader="false" height="30" >
        <div style="line-height:28px;text-align:center;">Copyright ©北京傲天飞宏科技有限公司</div>
    </div>
    
<script type="text/javascript">
	mini.parse();
	// 全局变量（判断是退出还是离席）
	var logOutFlag = false;
	
	// 最后一次登录时间
	var lastLoginTime = mini.get("last_login_time").getValue();
	$("#last_time").html(lastLoginTime.substring(0, lastLoginTime.lastIndexOf(".")));
	
    var tabs = mini.get("mainTabs");
	function showTab(node) {
	    var id = "tab$" + node.id;
	    var tab = tabs.getTab(id);
	    if (!tab) {
	        tab = {};
	        tab.name = id;
	        tab.title = node.text;
	        tab.showCloseButton = true;
	        tab.url = node.url;
	        tab.refreshOnClick= true
	        tabs.addTab(tab);
	    }  else {
	    	tabs.reloadTab(tab);
	    }
	    tabs.activeTab(tab);
	}       

    var currentTab = null;

    function onBeforeOpen(e) {
        currentTab = tabs.getTabByEvent(e.htmlEvent);
        if (!currentTab) {
            e.cancel = true;                
        }
    }
    
    function refreshTab() {
    	tabs.reloadTab(currentTab);
    }
    
    function closeTab() {
    	if(currentTab.name != 'first'){
    		tabs.removeTab(currentTab);
    	}
    }
    
    function closeAll() {
    	tabs.removeAll(tabs.getTab("first"));
    }
    
    function closeAllButFirst() {
        var but = [currentTab];            
        but.push(tabs.getTab("first"));
        tabs.removeAll(but);
    }
    
    function itemclick(e) {
		showTab({id: e.item.id, text: e.item.text, url: e.item.url});
	}
    
    function showMsg() {
		showTab({id: 'message', text:'消息列表', url:'message.do'});
		$("#msgNum").text("0");
		$.post("message_read.do");
	}
    
// 打开消息提示WebSocket
    var socket = new WebSocket("ws://172.16.2.11:8090/sd/ss");
    socket.onopen = function(){
   		var userId = mini.get("user_id").getValue();
  	  	socket.send(userId);
    };
    
  	var msgNum = $("#msgNum");
    socket.onmessage = function (evt)
    {
        var received_msg = evt.data;
       	msgNum.text(parseInt(msgNum.html()) + 1);
        if(received_msg.indexOf("|") == 0) {
        	mini.showMessageBox({
        		title: '消息',    
    		    width: 300,
    		    height: 180,
    		    buttons: ["查看"],    
    		    showModal:false,
    		    html: received_msg,
    		    x: 'right',
                y: 'bottom',
                timeout: 5000,
    		    callback: function(action){
    		    	showTab({id: 'call_manage_my_init', text:'我的话务管理', url:'call_manage_my_init.do'});
    		    	msgNum.text(msgNum.html()-1);
       			}
       		});
        } else {
        	mini.showMessageBox({
        		title: '消息',    
    		    width: 300,
    		    height: 180,
    		    showModal:false,
    		    html: received_msg,
    		    x: 'right',
                y: 'bottom',
                timeout: 5000,
       		});
        }
    };
    
/*---------------------------------------业务系统与软交换对接----------------------------------------------------------*/
    // 登录分机弹窗
    var win1 = mini.get("win1");
    var btnLoEx = mini.get("btn_lo_ex");		// 绑定分机按钮
    var btnLeave = mini.get("btn_leave");		// 解除绑定按钮
    var form1 = new mini.Form("win1");
    var el = btnLoEx.getEl();
    win1.showAtEl(el, {
	   xAlign:"left",
	   yAlign:"below"
	});
    function loginExtension() {
    	win1.showAtEl(el, {
		   xAlign:"left",
		   yAlign:"below"
		});
    }
    
    function onClose1(){
		win1.hide();
	}
    
    // 呼出弹窗
    var win2 = mini.get("win2");
    var form2 = new mini.Form("win2");
    function outgoing(e) {
    	var el=e.sender.getEl();
    	win2.showAtEl(el, {
		   xAlign:"left",
		   yAlign:"below"
		});
    }
    
    function onClose2() {
    	win2.hide();
    }
    
    // 盲转弹窗
    var win3 = mini.get("win3");
    var btnBlindTurn = mini.get("btn_blind_turn");
    function blindTurn(e) {
    	var el=e.sender.getEl();
    	win3.showAtEl(el, {
		   xAlign:"left",
		   yAlign:"below"
		});
    }
    
    function onClose3(){
		win3.hide();
	}
    
    
/*连接WebSocket*/
    jQuery.openWebSocket("ws://172.16.2.11:8080/websocket");
    
    var sextension = mini.get("s_extension");	// 分机
    var squeue = mini.get("s_queue");			// 队列
    
    // 连接成功时执行
    function webSocketOnOpen(event) {
    	$.post("alternately_find_ext_queue.do", function(data) {
    		if(data.success) {
    			jQuery.bindExtenNumAndWeb(data.extension, workId.getValue());
    			var queueNums = data.queue.split(",");
    			
    			for(var i=0; i<queueNums.length; i++) {
    				jQuery.queueAdd(queueNums[i], data.extension);
    		    }
    			extenNumId.setValue(data.extension);
    			callerNum.setValue(data.extension);
    			queueNum.setValue(data.queue);
    			sextension.setValue(data.extension);
    			squeue.setValue(data.queue);
    		}
    	}, "json");
	}
    
    // 关闭时执行
    function webSocketOnClose(event) {
    	
	}
    
    // 接收消息
    function webSocketOnMessage(event) {
    	var data = $.evalJSON(event.data);
    	console.info(data);
    	switch (data.Event) {
    	case "BindExtenNumAndWeb":
    		win1.hide();
			btnLoEx.hide();
			btnLeave.show();
			btnOutgoing.enable();
			btnBlindTurn.enable();
			extenNumId.setValue("");
			sextension.setValue(callerNum.getValue());
			squeue.setValue(queueNum.getValue());
    		break;
    	case "QueueMemberAdd":
    		$.post("alternately_login_ext.do", {userName: workId.getValue(), extension: callerNum.getValue(), queue: queueNum.getValue()}, function(data) {
   	 			if(data.success) {
	    			mini.showMessageBox({
		                title: "登录分机队列成功",
		                showModal:false,
		                iconCls: "mini-messagebox-info",
		                message: "成功加入" + queueNumId.getValue() + "队列",
		                timeout: 3000,
		                x: 'right',
		                y: 'bottom',
		            });
   	 			}
   	 		}, "json");
    		break;
    	case "UnBindExtenNumAndWeb":
    		if(data.IsUnBind) {
    			$.post("alternately_loginout_ext.do", {userName: workId.getValue(), extension: callerNum.getValue()}, function(data) {
	   	 			if(data.success) {
		    			if(logOutFlag) {
		    				location.href="j_spring_cas_security_logout";
		    			} else {
		    				btnLoEx.show();
			    			btnLeave.hide();
			    			btnOutgoing.disable();
			    			btnBlindTurn.disable();
			    			sextension.setValue("");
			    			squeue.setValue("");
		    			}
	   	 			} 
	   	 		}, "json");
    		} else {
 				mini.alert("离席失败");
 			}
    		break;
    	case "ScreenPopup":
    		if(data.Did.length != 0) {
	    		$.post("alternately_save_call.do", {did: data.Did, phoneNum: data.InLineNum, uuid: data.InLineChannelUniqueId, popupType: data.type}, function(data) {
	    			if(data.info == "fail") {
	    				mini.alert("外线号码未与企业绑定，请联系管理员");
	    			} else {
			    		curTabName.setValue(data.cId);
	    				var tab = tabs.getTab(data.cId);
	    				if(!tab) {
		    				tab = {
		    					name: data.cId, 
		    					title: "来电信息", 
		    					url: 'alternately_play_screen.do?callId=' + data.cId + "&callStatus=" + data.callStatus, 
		    					showCloseButton: true
		    				};
		    				tabs.addTab(tab);
	    				}
			            tabs.activeTab(tab);
	    			}
	    		}, "json");
    		}
    		break;
    	case "HangUp":
    		btnHangup.disable();	// 挂断禁用
    		btnOutgoing.enable();	// 呼出解除禁用
    		btnLeave.enable();		// 离席解除禁用
    		break;
    	case "QueuePause":
    		if(data.QueuePause == "1") {
    			btnBusy.disable();
    			btnIdle.enable();
    		} else {
    			btnBusy.enable();
    			btnIdle.disable();
    		}
    		break;
    	}
	}
    
    /**
	 *	绑定分机
	 * extenNum 分机号 
	 */
	var callerNum = mini.get("callerNum");				// 解除绑定、呼出、盲转主叫号码
	var extenNumId = mini.get("extenNumId");			// 分机号
	var workId = mini.get("workId");					// 工号
	var queueNumId = mini.get("queueNumId");			// 登录分机输入的队列
	var queueNum = mini.get("queueNum");				// 登录分机后的队列
	function loginExtensionOk() {
	    form1.validate();
	    if (form1.isValid() == false) return;
	    
	    $.post("alternately_find_Extension_online.do", {extension: extenNumId.getValue()}, function(data) {
	    	if(data.success) {
	    	    jQuery.bindExtenNumAndWeb(extenNumId.getValue(), workId.getValue());
	    	    var queues = queueNumId.getValue().split(",");
	    	    for(var i=0; i<queues.length; i++) {
	    			jQuery.queueAdd(queues[i], extenNumId.getValue());
	    	    }
	    		jQuery.pingWebSocket(extenNumId.getValue());		// 心跳检测
	    		
	    		// 设置分机号、队列号变量离席时使用
	    		callerNum.setValue(extenNumId.getValue());
	    		queueNum.setValue(queueNumId.getValue());
	    		extenNumId.setValue("");
	    		queueNumId.setValue("");
	    	} else {
	    		mini.alert("该分机号已被其他用户登录，请更换其他分机号。");
	    	}
	    }, "json");
	    
	}
	
	/**
	 * 解除绑定(话务员离席)
	 * extenNum  分机号
	 */
	function leave() {
		var queueNums = queueNum.getValue().split(",");
		for(var i=0; i<queueNums.length; i++) {
			jQuery.unBindExtenNumAndWeb(callerNum.getValue(), queueNums[i]);
			jQuery.queueRemove(queueNums[i], callerNum.getValue());
		}
	}

	/**
	 *	呼叫
	 * extenNum 主叫号码
	 * callNum  被叫号码 
	 */
	var addNum = mini.get("addNum");		// 加拨号码
	var outNumId = mini.get("outNumId");	// 外线号码
	var btnOutgoing = mini.get("btn_outgoing"); // 呼出按钮
	function outgoingOk() {
		var arr = new Array;
	    form2.validate();
	    if (form2.isValid() == false) return;
		arr[0] = addNum.getValue();
		arr[1] = outNumId.getValue();
		var callNum = arr.join("");
		jQuery.dail(callerNum.getValue(), callNum);
		win2.hide();
		btnOutgoing.disable();
		btnHangup.enable();
		btnLeave.disable();
	}
	
	/**
	  * 挂断 
	  * extenNum 分机号码 
	  */
	var btnHangup = mini.get("btn_hangup");
	function telHangUp() {
		jQuery.hangUp(callerNum.getValue());
	}
	
	/**
	 *	示闲/示忙
	 * extenNum 主叫号码
	 * callNum  被叫号码 
	 */
	var btnBusy = mini.get("btn_busy");
	var btnIdle = mini.get("btn_idle");
	function showIdle(flag) {
		if(flag == "false") {
// 			btnBusy.enable();
			btnBusy.enable();
			btnIdle.disable();
		}
		jQuery.queuePause(queueNum.getValue(), callerNum.getValue(), flag);
	}
	
	/**
	  * 盲转 
	  * extenNum 主叫号码
	  * callNum  被叫号码
	  */
	var blindTurnNum = mini.get("blindTurnNum");
	var curTabName = mini.get("cur_tab_name");
	function blindTurnOk() {
		var curTab = tabs.getTab(curTabName.getValue());
		$.post("alternately_busy_turn.do", {callId: curTabName.getValue(), extension: blindTurnNum.getValue()}, function(data) {
			if(data.success) {
				tabs.removeTab(curTab);
				jQuery.redirect(callerNum.getValue(), blindTurnNum.getValue());
				blindTurnNum.setValue("");
				win3.hide();
			} else {
				mini.alert("数据错误，任务id或分机号为空。");
			}
		}, "json");
	}
	
	// 退出登录
	function logOut() {
		if(callerNum.getValue().length > 0 && queueNum.getValue().length > 0) {
			logOutFlag = true;
			leave();
		} else {
			location.href="j_spring_cas_security_logout";
		}
	}
	
</script>
</body>
</html>